package com.haoniu.common.utils.sms;

import com.haoniu.common.config.Global;
import com.haoniu.common.utils.YamlUtil;

/**
 * 描述:
 *
 * @author fei
 * @create 2019-03-18 18:05
 */
public class SmsUtil {

    private static String ENV = "dev";
    /**
     * 短信平台
     */
    private static String SMS_PLATFORM = "chuangRui";

    static {
        ENV = Global.getConfig("spring.profiles.active");
        SMS_PLATFORM = YamlUtil.getProperty("application-" + ENV + ".yml", "sms.platform");
    }

    /**
     * 发送短信到平台
     *
     * @param phone
     * @param code
     * @return
     */
    public static boolean send(String phone, String code) {
        if ("chuangRui".equals(SMS_PLATFORM)) {
            return ChuangRuiSms.send(phone, code);
        }
        return false;
    }
}
